# coding: utf-8
from flask_sqlalchemy import SQLAlchemy

db = SQLAlchemy()


class Account(db.Model):
    __tablename__ = 'account'

    id = db.Column(db.Integer, primary_key=True)
    account_type = db.Column(db.String(255))
    account_name = db.Column(db.String(255))
    remark = db.Column(db.String(255))
    username = db.Column(db.String(255))
    password = db.Column(db.String(255))
    account_address = db.Column(db.String(255))
    port = db.Column(db.String(255))


class Addtask(db.Model):
    __tablename__ = 'addtask'

    id = db.Column(db.Integer, primary_key=True)
    task_name = db.Column(db.String(120), nullable=False)
    begin_time = db.Column(db.String(300), nullable=False)
    add_time = db.Column(db.DateTime, nullable=False, server_default=db.FetchedValue())
    type = db.Column(db.Integer)


class AddtaskOperateLog(db.Model):
    __tablename__ = 'addtask_operate_log'

    id = db.Column(db.Integer, primary_key=True, info='自增主键')
    task_operate_user = db.Column(db.String(120), nullable=False, info='操作人')
    task_operate_time = db.Column(db.DateTime, nullable=False, server_default=db.FetchedValue(), info='操作时间')
    task_operate_type = db.Column(db.String(120), nullable=False, info='操作类型（自动执行，手动执行，增，删，改，查）')
    task_operate_result = db.Column(db.String(120), nullable=False, info='执行结果')
    task_operate_log = db.Column(db.String(2000), info='操作日志')
    addtask_task_id = db.Column(db.Integer, nullable=False, info='关联任务id')
    operate_old = db.Column(db.String(500), info='操作之前的值')
    operate_now = db.Column(db.String(500), info='操作之后的值')
    operate_fields = db.Column(db.String(300), info='操作的字段')


class BugReopen(db.Model):
    __tablename__ = 'bug_reopen'

    id = db.Column(db.Integer, primary_key=True)
    bug_id = db.Column(db.Integer, nullable=False)
    bug_title = db.Column(db.String(240), nullable=False)
    bug_name = db.Column(db.String(120), nullable=False)
    addtime = db.Column(db.Date, nullable=False)


class Bugcalculate(db.Model):
    __tablename__ = 'bugcalculate'

    id = db.Column(db.Integer, primary_key=True)
    vname = db.Column(db.String(120, 'utf8_unicode_ci'), nullable=False)
    proname = db.Column(db.String(120, 'utf8_unicode_ci'), nullable=False)
    versionname = db.Column(db.String(120, 'utf8_unicode_ci'))
    name = db.Column(db.String(120, 'utf8_unicode_ci'))
    checknum = db.Column(db.Integer, nullable=False)
    fristnum = db.Column(db.Integer, nullable=False)
    leaknum = db.Column(db.Integer, nullable=False)
    newnum = db.Column(db.Integer, nullable=False)
    bugcount = db.Column(db.Integer, nullable=False)
    bugdensity = db.Column(db.Float, nullable=False)
    fristleak = db.Column(db.Float, nullable=False)
    bringerror = db.Column(db.Float, nullable=False)
    addtime = db.Column(db.Date, nullable=False)


class BugcalculateCopy(db.Model):
    __tablename__ = 'bugcalculate_copy'

    id = db.Column(db.Integer, primary_key=True)
    vname = db.Column(db.String(120, 'utf8_unicode_ci'), nullable=False)
    proname = db.Column(db.String(120, 'utf8_unicode_ci'), nullable=False)
    versionname = db.Column(db.String(120, 'utf8_unicode_ci'))
    name = db.Column(db.String(120, 'utf8_unicode_ci'))
    checknum = db.Column(db.Integer, nullable=False)
    fristnum = db.Column(db.Integer, nullable=False)
    leaknum = db.Column(db.Integer, nullable=False)
    newnum = db.Column(db.Integer, nullable=False)
    bugcount = db.Column(db.Integer, nullable=False)
    bugdensity = db.Column(db.Float, nullable=False)
    fristleak = db.Column(db.Float, nullable=False)
    bringerror = db.Column(db.Float, nullable=False)
    addtime = db.Column(db.Date, nullable=False)


class BugcalculateCopy1(db.Model):
    __tablename__ = 'bugcalculate_copy1'

    id = db.Column(db.Integer, primary_key=True)
    vname = db.Column(db.String(120, 'utf8_unicode_ci'), nullable=False)
    proname = db.Column(db.String(120, 'utf8_unicode_ci'), nullable=False)
    versionname = db.Column(db.String(120, 'utf8_unicode_ci'))
    name = db.Column(db.String(120, 'utf8_unicode_ci'))
    checknum = db.Column(db.Integer, nullable=False)
    fristnum = db.Column(db.Integer, nullable=False)
    leaknum = db.Column(db.Integer, nullable=False)
    newnum = db.Column(db.Integer, nullable=False)
    bugcount = db.Column(db.Integer, nullable=False)
    bugdensity = db.Column(db.Float, nullable=False)
    fristleak = db.Column(db.Float, nullable=False)
    bringerror = db.Column(db.Float, nullable=False)
    addtime = db.Column(db.Date, nullable=False)


class BugmiduDay(db.Model):
    __tablename__ = 'bugmidu_day'

    id = db.Column(db.Integer, primary_key=True)
    addtime = db.Column(db.Date, nullable=False)
    density = db.Column(db.Float, nullable=False)
    leakage = db.Column(db.Float, nullable=False)
    lead = db.Column(db.Float, nullable=False)
    updatetime = db.Column(db.Date, nullable=False)


class Case(db.Model):
    __tablename__ = 'case'

    id = db.Column(db.Integer, primary_key=True)
    group_name = db.Column(db.String(255))
    project_name = db.Column(db.String(50), nullable=False, server_default=db.FetchedValue())
    case_name = db.Column(db.String(50), nullable=False, server_default=db.FetchedValue())
    case_type = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='1:web_ui 2:app_ui 3:接口')
    case_value = db.Column(db.String(500), nullable=False, server_default=db.FetchedValue())
    submit_uid = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue())
    update_uid = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue())
    is_deploy = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue())
    case_num = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue())
    create_time = db.Column(db.DateTime, nullable=False, server_default=db.FetchedValue())
    update_time = db.Column(db.DateTime, nullable=False, server_default=db.FetchedValue())


class Collect(db.Model):
    __tablename__ = 'collect'

    pid = db.Column(db.Integer, primary_key=True)
    group = db.Column(db.String(50), server_default=db.FetchedValue(), info='业务线')
    project = db.Column(db.String(250), server_default=db.FetchedValue(), info='项目名称')
    version = db.Column(db.String(100), server_default=db.FetchedValue(), info='版本号')
    ptype = db.Column(db.String(50), info='需求类型（1：标准需求，2：验收需求，3：生产事故，4：线上bug，5：紧急发版）')
    pstatus = db.Column(db.String(50), server_default=db.FetchedValue(), info='项目状态（1：测试中，2：测试完成，3：已上线）')
    onlinedate = db.Column(db.Date, info='上线时间')
    begindate = db.Column(db.Date, info='开始时间')
    enddate = db.Column(db.Date, info='结束时间')
    ticecount = db.Column(db.Integer, info='提测次数')
    anticecount = db.Column(db.Integer, info='按时提测次数')
    zhunrucount = db.Column(db.Integer, info='准入次数')
    zhunchucount = db.Column(db.Integer, info='准出次数')
    anzhuchucount = db.Column(db.Integer, info='按时准出次数')
    casecount = db.Column(db.Integer, info='检查点数量')
    maobugcount = db.Column(db.Integer, info='冒烟bug数量')
    fistbugcount = db.Column(db.Integer, info='第一轮bug数量')
    weibugcount = db.Column(db.Integer, info='当前版本未解决bug总数')
    sumbugcount = db.Column(db.Integer, info='bug总数')
    yiliubug = db.Column(db.Integer, info='遗留bug总数')
    P1 = db.Column(db.Integer)
    P2 = db.Column(db.Integer)
    P3 = db.Column(db.Integer)
    P4 = db.Column(db.Integer)
    P5 = db.Column(db.Integer)
    tiyanbug = db.Column(db.Integer, info='体验bug')
    changecount = db.Column(db.Integer, info='需求变更次数')
    reopenbug = db.Column(db.Integer, info='重新打开的bug')
    spendtime = db.Column(db.Integer, info='研发工时')
    online = db.Column(db.Integer, info='是否上线')
    isonline = db.Column(db.Integer, info='是否按时上线')
    onlinecount = db.Column(db.Integer, server_default=db.FetchedValue(), info='上线次数')
    rollcount = db.Column(db.Integer, info='回滚次数')
    pquest = db.Column(db.String(5000), server_default=db.FetchedValue(), info='项目问题')
    remark = db.Column(db.String(5000), info='备注')
    addtiem = db.Column(db.DateTime, info='添加时间')
    bugrate = db.Column(db.String(50), info='bug率（权重/工时）')
    fixrate = db.Column(db.String(50), info='bug修复率')
    unfixrate = db.Column(db.String(50), info='无效修改率')
    onlinerate = db.Column(db.String(50), info='发布成功率')
    bugdensity = db.Column(db.String(50), info='bug密度')
    dmchange = db.Column(db.Integer, info='需求变更次数')
    dmcount = db.Column(db.Integer, info='需求类统计')
    bugcount = db.Column(db.Integer, info='bug总数')
    status = db.Column(db.Integer, server_default=db.FetchedValue(), info='0 删除，1未删除')
    venusid = db.Column(db.Integer, info='看板对应项目id')
    mantisid = db.Column(db.Integer, info='mantis对应id')
    project_id = db.Column(db.Integer, info='项目在mantis上对应的project_id')
    v_group = db.Column(db.String(255), info='实验室业务线')
    v_project = db.Column(db.String(255), info='实验室项目')
    v_version = db.Column(db.String(255), info='实验室版本号')
    creater_qa = db.Column(db.String(255), nullable=False, info='录入人')


class CollectSum(db.Model):
    __tablename__ = 'collect_sum'

    id = db.Column(db.Integer, primary_key=True, info='序号')
    business = db.Column(db.String(255), info='业务')
    project_nums = db.Column(db.String(255), info='参与项目数量')
    count_times = db.Column(db.String(255), info='总工时')
    access_rate = db.Column(db.String(255), info='准入率')
    must_rate = db.Column(db.String(255), info='准出率')
    access_on_rate = db.Column(db.String(255), info='按时准入率')
    must_out_rate = db.Column(db.String(255), info='按时准出率')
    release_success = db.Column(db.String(255), info='发布准时率')
    repair_rate = db.Column(db.String(255), info='bug修复率')
    bug_rate = db.Column(db.String(255), info='bug率')
    Invalid_rate = db.Column(db.String(255), nullable=False, info='无效修改率')
    release_rate = db.Column(db.String(255), nullable=False, info='发布成功率')
    change = db.Column(db.String(255), info='需求及变更次数')
    updated_time = db.Column(db.DateTime, info='提交时间')
    status = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='0旧数据，1新数据')
    nature_week = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='0自然周，1非自然周')
    type_standard = db.Column(db.Integer, server_default=db.FetchedValue(), info='标准需求')
    type_check = db.Column(db.Integer, server_default=db.FetchedValue(), info='验收需求')
    type_production_accident = db.Column(db.Integer, server_default=db.FetchedValue(), info='生产事故')
    type_online_bug = db.Column(db.Integer, server_default=db.FetchedValue(), info='线上bug')
    type_emergency_edition = db.Column(db.Integer, server_default=db.FetchedValue(), info='紧急发版')
    inflow_demand = db.Column(db.Integer, server_default=db.FetchedValue(), info='流入需求')
    online_demand = db.Column(db.Integer, server_default=db.FetchedValue(), info='上线需求')
    complete_demand = db.Column(db.Integer, server_default=db.FetchedValue(), info='完成需求')
    whole_bug_rate = db.Column(db.String(255), info='整体bug率')
    whole_Invalid_rate = db.Column(db.String(255), info='整体无效修改率')
    whole_release_rate = db.Column(db.String(255), info='整体发布成功率')


class CollectSumCopy1(db.Model):
    __tablename__ = 'collect_sum_copy1'

    id = db.Column(db.Integer, primary_key=True, info='序号')
    business = db.Column(db.String(255), info='业务')
    project_nums = db.Column(db.String(255), info='参与项目数量')
    count_times = db.Column(db.String(255), info='总工时')
    access_rate = db.Column(db.String(255), info='准入率')
    must_rate = db.Column(db.String(255), info='准出率')
    access_on_rate = db.Column(db.String(255), info='按时准入率')
    must_out_rate = db.Column(db.String(255), info='按时准出率')
    release_success = db.Column(db.String(255), info='发布准时率')
    repair_rate = db.Column(db.String(255), info='bug修复率')
    bug_rate = db.Column(db.String(255), info='bug率')
    Invalid_rate = db.Column(db.String(255), nullable=False, info='无效修改率')
    release_rate = db.Column(db.String(255), nullable=False, info='发布成功率')
    change = db.Column(db.String(255), info='需求及变更次数')
    updated_time = db.Column(db.DateTime, info='提交时间')
    status = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='0旧数据，1新数据')
    nature_week = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='0自然周，1非自然周')
    type_standard = db.Column(db.Integer, server_default=db.FetchedValue(), info='标准需求')
    type_check = db.Column(db.Integer, server_default=db.FetchedValue(), info='验收需求')
    type_production_accident = db.Column(db.Integer, server_default=db.FetchedValue(), info='生产事故')
    type_online_bug = db.Column(db.Integer, server_default=db.FetchedValue(), info='线上bug')
    type_emergency_edition = db.Column(db.Integer, server_default=db.FetchedValue(), info='紧急发版')
    inflow_demand = db.Column(db.Integer, server_default=db.FetchedValue(), info='流入需求')
    online_demand = db.Column(db.Integer, server_default=db.FetchedValue(), info='上线需求')
    complete_demand = db.Column(db.Integer, server_default=db.FetchedValue(), info='完成需求')
    whole_bug_rate = db.Column(db.String(255), info='整体bug率')
    whole_Invalid_rate = db.Column(db.String(255), info='整体无效修改率')
    whole_release_rate = db.Column(db.String(255), info='整体发布成功率')


class CollectSumCopy2(db.Model):
    __tablename__ = 'collect_sum_copy2'

    id = db.Column(db.Integer, primary_key=True, info='序号')
    business = db.Column(db.String(255), info='业务')
    project_nums = db.Column(db.String(255), info='参与项目数量')
    count_times = db.Column(db.String(255), info='总工时')
    access_rate = db.Column(db.String(255), info='准入率')
    must_rate = db.Column(db.String(255), info='准出率')
    access_on_rate = db.Column(db.String(255), info='按时准入率')
    must_out_rate = db.Column(db.String(255), info='按时准出率')
    release_success = db.Column(db.String(255), info='发布准时率')
    repair_rate = db.Column(db.String(255), info='bug修复率')
    bug_rate = db.Column(db.String(255), info='bug率')
    Invalid_rate = db.Column(db.String(255), nullable=False, info='无效修改率')
    release_rate = db.Column(db.String(255), nullable=False, info='发布成功率')
    change = db.Column(db.String(255), info='需求及变更次数')
    updated_time = db.Column(db.DateTime, info='提交时间')
    status = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='0旧数据，1新数据')
    nature_week = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='0自然周，1非自然周')
    type_standard = db.Column(db.Integer, server_default=db.FetchedValue(), info='标准需求')
    type_check = db.Column(db.Integer, server_default=db.FetchedValue(), info='验收需求')
    type_production_accident = db.Column(db.Integer, server_default=db.FetchedValue(), info='生产事故')
    type_online_bug = db.Column(db.Integer, server_default=db.FetchedValue(), info='线上bug')
    type_emergency_edition = db.Column(db.Integer, server_default=db.FetchedValue(), info='紧急发版')
    inflow_demand = db.Column(db.Integer, server_default=db.FetchedValue(), info='流入需求')
    online_demand = db.Column(db.Integer, server_default=db.FetchedValue(), info='上线需求')
    complete_demand = db.Column(db.Integer, server_default=db.FetchedValue(), info='完成需求')
    whole_bug_rate = db.Column(db.String(255), info='整体bug率')
    whole_Invalid_rate = db.Column(db.String(255), info='整体无效修改率')
    whole_release_rate = db.Column(db.String(255), info='整体发布成功率')


class JobTask(db.Model):
    __tablename__ = 'job_task'

    id = db.Column(db.Integer, primary_key=True)
    task_name = db.Column(db.String(50), nullable=False, server_default=db.FetchedValue())
    job_name = db.Column(db.String(50), nullable=False, server_default=db.FetchedValue())
    status = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='0停用；1启用')
    ding_token = db.Column(db.String(500))
    create_time = db.Column(db.DateTime, nullable=False, server_default=db.FetchedValue())


class MantisUserTable(db.Model):
    __tablename__ = 'mantis_user_table'

    id = db.Column(db.Integer, primary_key=True)
    username = db.Column(db.String(191), nullable=False, unique=True, server_default=db.FetchedValue())
    realname = db.Column(db.String(191), nullable=False, server_default=db.FetchedValue())
    email = db.Column(db.String(191), nullable=False, index=True, server_default=db.FetchedValue())
    password = db.Column(db.String(64), nullable=False, server_default=db.FetchedValue())
    enabled = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue())
    protected = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue())
    access_level = db.Column(db.SmallInteger, nullable=False, index=True, server_default=db.FetchedValue())
    login_count = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue())
    lost_password_request_count = db.Column(db.SmallInteger, nullable=False, server_default=db.FetchedValue())
    failed_login_count = db.Column(db.SmallInteger, nullable=False, server_default=db.FetchedValue())
    cookie_string = db.Column(db.String(64), nullable=False, unique=True, server_default=db.FetchedValue())
    last_visit = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue())
    date_created = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue())


class Node(db.Model):
    __tablename__ = 'nodes'

    id = db.Column(db.Integer, primary_key=True)
    node_name = db.Column(db.String(255), nullable=False)
    ipv4 = db.Column(db.String(255), nullable=False)
    content = db.Column(db.String(255))
    tasks = db.Column(db.String(255))
    system = db.Column(db.String(255))
    callback_ip4 = db.Column(db.String(255))
    create_time = db.Column(db.DateTime, server_default=db.FetchedValue())
    update_time = db.Column(db.DateTime, server_default=db.FetchedValue())
    callback_ipv4_port = db.Column(db.Integer)
    ipv4_port = db.Column(db.Integer)


class OtMember(db.Model):
    __tablename__ = 'ot_member'

    uid = db.Column(db.Integer, primary_key=True, info='用户ID')
    nickname = db.Column(db.String(16), nullable=False, unique=True, server_default=db.FetchedValue(), info='昵称')
    sex = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='性别 1 男 2女  0 未知')
    birthday = db.Column(db.Date, nullable=False, server_default=db.FetchedValue(), info='生日')
    qq = db.Column(db.String(10), nullable=False, server_default=db.FetchedValue(), info='qq号')
    score = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='用户积分')
    login = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='登录次数')
    reg_ip = db.Column(db.BigInteger, nullable=False, server_default=db.FetchedValue(), info='注册IP')
    reg_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='注册时间')
    last_login_ip = db.Column(db.BigInteger, nullable=False, server_default=db.FetchedValue(), info='最后登录IP')
    last_login_time = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='最后登录时间')
    status = db.Column(db.Integer, nullable=False, index=True, server_default=db.FetchedValue(), info='会员状态')
    username = db.Column(db.String(16), nullable=False, unique=True, server_default=db.FetchedValue())
    password = db.Column(db.String(32), nullable=False, server_default=db.FetchedValue())
    email = db.Column(db.String(32), nullable=False, server_default=db.FetchedValue())
    mobile = db.Column(db.String(11), nullable=False, server_default=db.FetchedValue())
    type = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue())
    avatar = db.Column(db.String(255), nullable=False, server_default=db.FetchedValue())
    job_number = db.Column(db.String(8), nullable=False, server_default=db.FetchedValue(), info='工号')
    ID_card = db.Column(db.String(18), nullable=False, server_default=db.FetchedValue(), info='身份证号')
    department = db.Column(db.String(32), nullable=False, server_default=db.FetchedValue(), info='所在部门名称')
    ding_talk_userid = db.Column(db.String(32), nullable=False, server_default=db.FetchedValue(), info='钉钉账号id')


class PersonnelRateGroupList(db.Model):
    __tablename__ = 'personnel_rate_group_list'

    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(255), info='姓名')
    bug_rate = db.Column(db.String(255), info='bug率')
    bug_num = db.Column(db.String(255), info='bug数')
    group = db.Column(db.String(255))


class ProjectRelevance(db.Model):
    __tablename__ = 'project_relevance'

    vmid = db.Column(db.Integer, primary_key=True)
    qa_gname = db.Column(db.String(50))
    qa_pname = db.Column(db.String(50))
    venus_id = db.Column(db.Integer)
    venus_gname = db.Column(db.String(50))
    venus_pname = db.Column(db.String(50))
    mantis_id = db.Column(db.Integer)
    mantis_gname = db.Column(db.String(50))
    mantis_pname = db.Column(db.String(50))


class ReplyTest(db.Model):
    __tablename__ = 'reply_test'

    id = db.Column(db.Integer, primary_key=True)
    addressee = db.Column(db.String(500))
    cc = db.Column(db.String(500))
    project = db.Column(db.String(50))
    pversion = db.Column(db.String(120))
    platform = db.Column(db.String(50))
    mantis_adress = db.Column(db.String(255))
    remarks = db.Column(db.String(500))
    addtime = db.Column(db.DateTime, server_default=db.FetchedValue())


class Report(db.Model):
    __tablename__ = 'report'

    id = db.Column(db.Integer, primary_key=True)
    task_id = db.Column(db.Integer, server_default=db.FetchedValue())
    build_id = db.Column(db.Integer, server_default=db.FetchedValue())
    case_id = db.Column(db.Integer, server_default=db.FetchedValue())
    type = db.Column(db.Integer, server_default=db.FetchedValue(), info='1:web_ui 2:app_ui 3:接口')
    total = db.Column(db.Integer, server_default=db.FetchedValue())
    succ = db.Column(db.Integer, server_default=db.FetchedValue())
    fail = db.Column(db.Integer, server_default=db.FetchedValue())
    err = db.Column(db.Integer, server_default=db.FetchedValue())
    info = db.Column(db.String(500), server_default=db.FetchedValue())
    is_ding = db.Column(db.Integer, server_default=db.FetchedValue(), info='是否发送过钉钉通知1:是 2:否')
    create_time = db.Column(db.DateTime, server_default=db.FetchedValue())
    update_time = db.Column(db.DateTime, server_default=db.FetchedValue())


class Taskcase(db.Model):
    __tablename__ = 'taskcase'

    id = db.Column(db.Integer, primary_key=True)
    task_id = db.Column(db.ForeignKey('job_task.id'), nullable=False, index=True, server_default=db.FetchedValue())
    case_id = db.Column(db.ForeignKey('case.id'), nullable=False, index=True, server_default=db.FetchedValue())
    node_id = db.Column(db.Integer)
    is_deploy = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue(), info='0-未部署；1-已部署')

    case = db.relationship('Case', primaryjoin='Taskcase.case_id == Case.id', backref='taskcases')
    task = db.relationship('JobTask', primaryjoin='Taskcase.task_id == JobTask.id', backref='taskcases')


class TestProject(db.Model):
    __tablename__ = 'test_project'

    id = db.Column(db.Integer, primary_key=True)
    collect_collectid = db.Column(db.Integer, nullable=False)
    business = db.Column(db.String(20))
    product = db.Column(db.String(20))
    version = db.Column(db.String(20))
    status = db.Column(db.Integer)


class TestReportTable(db.Model):
    __tablename__ = 'test_report_table'

    id = db.Column(db.Integer, primary_key=True)
    addressee = db.Column(db.String(500), info='收件人')
    cc = db.Column(db.String(500), info='抄送人')
    project_name = db.Column(db.String(100), info='项目名称')
    begin_time = db.Column(db.Date, info='开始时间')
    end_time = db.Column(db.Date, info='结束时间')
    several_days = db.Column(db.Float, info='几人/天')
    pro_manager = db.Column(db.String(50), info='产品经理')
    developer = db.Column(db.String(180), info='开发人员')
    qa = db.Column(db.String(50), info='测试人员')
    bug_counts = db.Column(db.Integer, info='bug总数')
    bug_repair = db.Column(db.Integer, info='已修复bug')
    bug_legacy = db.Column(db.Integer, info='遗留bug')
    advice_counts = db.Column(db.Integer, info='用户体验/建议bug')
    bug_density = db.Column(db.Float, info='bug密度')
    bug_introd = db.Column(db.Float, info='bug引入率')
    conclusion = db.Column(db.String(20), info='结论')
    mantis_adress = db.Column(db.String(5000), info='mantis地址')
    mantis_account = db.Column(db.String(50), info='mantis账号')
    remarks = db.Column(db.String(500), info='备注')
    addtime = db.Column(db.Date, info='增加时间')


class User(db.Model):
    __tablename__ = 'user'

    id = db.Column(db.Integer, primary_key=True)
    uid = db.Column(db.Integer, nullable=False)
    name = db.Column(db.String(8), nullable=False)
    img = db.Column(db.String(128))
    authority = db.Column(db.Integer, nullable=False)


class VenusManti(db.Model):
    __tablename__ = 'venus_mantis'

    pid = db.Column(db.Integer, primary_key=True)
    typeid = db.Column(db.Integer, nullable=False, info='1标准需求，2验收需求，3线上bug，4，紧急发版，5生产事故')
    venusid = db.Column(db.Integer)
    mantisid = db.Column(db.Integer)


class Weekly(db.Model):
    __tablename__ = 'weekly'

    id = db.Column(db.Integer, primary_key=True, info='自增id')
    create_time = db.Column(db.String(255), nullable=False, server_default=db.FetchedValue(), info='周报创建时间，时间范围显示')
    whole_bug_rate = db.Column(db.String(255), info='整体bug率')
    update_time = db.Column(db.DateTime, nullable=False, server_default=db.FetchedValue(), info='最后更新')
    bug_rate_chart = db.Column(db.Text, info='bug率统计图数据')
    last_week_date = db.Column(db.String(255), info='上周bug统计图时间')
    before_last_week_date = db.Column(db.String(255), info='上上周bug统计图时间')
    this_week_date = db.Column(db.String(255), info='本周bug统计图时间')
    collects = db.Column(db.String(10000), info='bug率统计图数据')
    collect_start_time = db.Column(db.DateTime, info='项目指标收集开始时间')
    collect_end_time = db.Column(db.DateTime, info='项目指标收集结束时间')
    creater = db.Column(db.String(255), nullable=False, info='创建人')
    whole_fixrate = db.Column(db.String(255), info='整体bug修复率')
    whole_unfixrate = db.Column(db.String(255), info='整体无效修改率')
    whole_onlinerate = db.Column(db.String(255), info='整体发布成功率')
    whole_bugcount = db.Column(db.Integer, info='bug总数')
    status = db.Column(db.Integer, info='0:已删除；1：未删除')
    last_operator = db.Column(db.String(255), info='最后操作人')
    create_date = db.Column(db.DateTime, info='创建时间')


class WeeklyCollectOperateLog(db.Model):
    __tablename__ = 'weekly_collect_operate_log'

    id = db.Column(db.Integer, primary_key=True, info='自增id')
    group = db.Column(db.String(255), info='业务线')
    operator = db.Column(db.String(255), nullable=False, info='操作人')
    collect_summary_old = db.Column(db.String(10000), info='项目总结-old值')
    collect_summary = db.Column(db.String(10000), info='项目总结新值')
    create_time = db.Column(db.DateTime, nullable=False, server_default=db.FetchedValue(), info='操作时间')
    weekly_id = db.Column(db.Integer, nullable=False, info='周报id')
